package com.adu.adusharding.service.Impl;

import com.adu.adusharding.domain.BatchUser;
import com.adu.adusharding.domain.User;
import com.adu.adusharding.mapper.UserMapper;
import com.adu.adusharding.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    private Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
    @Autowired
    UserMapper userMapper;
    @Override
    public Integer save(User user) {
        int flag=userMapper.save(user);
        return flag;
    }

    @Override
    public User findById(Integer id) {
        logger.info("查询id："+id);
        User user=userMapper.findById(id);
        return user;
    }

    @Override
    public List<User> findAll() {
        List<User> userList=userMapper.findAll();
        return userList;
    }

    @Override
    public Integer deleteById(Integer id) {
        int flag=userMapper.deleteById(id);
        return flag;
    }

    @Override
    public Integer update(User user) {
        int flag=userMapper.update(user);
        return flag;
    }

    @Override
    public Integer batchSave(BatchUser userList) {
        int flag=userMapper.batchSave(userList);
        return flag;
    }
}
